package example.model;

import java.util.Date;





public class Account implements IModel {
	
	private String accno;

	private String owner;

	private Date dateOpen;

	private String accountType;

	private int balance;
	
	private boolean active;

	public String getAccno() {
		return accno;
	}

	public void setAccno(String accno) {
		this.accno = accno;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	public Date getDateOpen() {
		return dateOpen;
	}

	public void setDateOpen(Date dateOpen) {
		this.dateOpen = dateOpen;
	}

	public String getAccountType() {
		return accountType;
	}

	public void setAccountType(String accountType) {
		this.accountType = accountType;
	}

	public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		this.balance = balance;
	}

	public String toString(){
		return "(ACCOUNT) [accno]: "+accno+"; [owner]: "+owner+"; [dateOpen]: "+dateOpen+"; [accountType]: "+accountType+"; [balance]: "+balance+"; [active]: "+active;
	}
	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((accno == null) ? 0 : accno.hashCode());
		result = prime * result
				+ ((accountType == null) ? 0 : accountType.hashCode());
		result = prime * result + (active ? 1231 : 1237);
		result = prime * result + balance;
		result = prime * result
				+ ((dateOpen == null) ? 0 : dateOpen.hashCode());
		result = prime * result + ((owner == null) ? 0 : owner.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Account))
			return false;
		Account other = (Account) obj;
		if (accno == null) {
			if (other.accno != null)
				return false;
		} else if (!accno.equals(other.accno))
			return false;
		if (accountType == null) {
			if (other.accountType != null)
				return false;
		} else if (!accountType.equals(other.accountType))
			return false;
		if (active != other.active)
			return false;
		if (balance != other.balance)
			return false;
		if (dateOpen == null) {
			if (other.dateOpen != null)
				return false;
		} else if (!dateOpen.equals(other.dateOpen))
			return false;
		if (owner == null) {
			if (other.owner != null)
				return false;
		} else if (!owner.equals(other.owner))
			return false;
		return true;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public String getPrimaryKey() {
		return this.accno;
	}

	public void setPrimaryKey(String pk) {
		this.accno = pk;
	}
	
	

	

}
